package gagak.framework.web.io;

import gagak.framework.web.annonation.Nullable;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.nio.channels.ReadableByteChannel;

/*
 * @see #getInputStream()
 * @see #getURL()
 * @see #getURI()
 * @see #getFile()
 * @see WritableResource
 * @see ContextResource
 * @see UrlResource
 * @see FileUrlResource
 * @see FileSystemResource
 * @see ClassPathResource
 * @see ByteArrayResource
 * @see InputStreamResource
 */
public interface Resource extends InputStreamSource {


	boolean exists();


	 boolean isReadable();


	 boolean isOpen();


	 boolean isFile();


	URL getURL() throws IOException;


	URI getURI() throws IOException;

	File getFile() throws IOException;


	/* ReadableByteChannel readableChannel() throws IOException {
		return Channels.newChannel(getInputStream());
	}*/
	ReadableByteChannel readableChannel() throws IOException;
	/*
	 * Determine the content length for this resource.
	 * @throws IOException if the resource cannot be resolved
	 * (in the file system or as some other known physical resource type)
	 */
	long contentLength() throws IOException;


	long lastModified() throws IOException;


	Resource createRelative(String relativePath) throws IOException;


	@Nullable
    String getFilename();


	String getDescription();

}
